<?php
    include_once("../inc/connection.php");
    include_once("../inc/constants.inc.php");
    $studentId = mysql_real_escape_string($_GET['studentId']);
	//$typeId = mysql_real_escape_string($_GET['typeId']);
  
    /* email exsitance */
	//$sql = "UPDATE `answer_sheet` SET isReset='yes' WHERE StudentID=$studentId && typeId=$typeId";
	$sql = "UPDATE `answer_sheet` SET isReset='yes' WHERE StudentID=$studentId";
	if(mysql_query($sql))
		{
			$q = "UPDATE `login_details` SET submitted='no' WHERE userID=$studentId";
			if(!mysql_query($q))
				echo "error occurred";
			//$deleteQuery = "DELETE FROM `timer` WHERE student_id=$studentId && type_id=$typeId";
			$deleteQuery = "DELETE FROM `timer` WHERE student_id=$studentId";
			mysql_query($deleteQuery);
			echo "Reset Successful";
		}
	else
		{
			echo "Reset Unsuccessful! Try Again";
		}
?>